home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / SCSI Samples 1.0 / SCSI Simple Sample 06⁄15 ƒ / Src / SCSIGetMaxTargetID.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-16  |  1.1 KB  |  44 lines  |  [TEXT/KAHL]

  1. /*                                SCSIGetMaxTargetID.c                            */
  2. /*
  3.  * SCSIGetMaxTargetID.c
  4.  * Copyright © 1992-94 Apple Computer Inc. All Rights Reserved.
  5.  */
  6. #include "SCSISimpleSample.h"
  7. /*
  8.  * Get the last host bus adaptor. Returns zero (and noErr) for Old SCSI.
  9.  */
  10. OSErr
  11. SCSIGetMaxTargetID(
  12.         DeviceIdent                        scsiDevice,
  13.         unsigned short                    *maxTarget
  14.     )
  15. {
  16.         OSErr                            status;
  17.         SCSIBusInquiryPB                busInquiryPB;        
  18. #define PB                                (busInquiryPB)
  19.  
  20.         if (gEnableNewSCSIManager == FALSE || (scsiDevice.bus == 0)) {
  21.             /*
  22.              * It is possible for the "sophisticated user" to change
  23.              * the initiator id from seven to some other value. This
  24.              * allows a Macintosh to be used in a multiple-initiator
  25.              * environment. We return seven in all cases, as the loop
  26.              * in DoListSCSIDevices will skip over the initiator id.
  27.              */
  28.             *maxTarget = 7;
  29.             status = noErr;
  30.         }
  31.         else {
  32.             CLEAR(PB);
  33.             PB.scsiPBLength = sizeof PB;
  34.             PB.scsiFunctionCode = SCSIBusInquiry;
  35.             PB.scsiDevice = scsiDevice;
  36.             status = SCSIAction((SCSI_PB *) &PB);
  37.             if (status == noErr)
  38.                 *maxTarget = PB.scsiMaxTarget;
  39.         }
  40.         return (status);
  41. #undef PB
  42. }
  43.  
  44.